<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>canvas的基本使用</title>
        <style>
            * {
                margin: 0;
                padding: 0;
            }
        </style>
    </head>
    <body>
        <canvas id="canvas" width="300" height="300"></canvas>
    </body>
    <script>
        const el = document.querySelector('#canvas')
        const ctx = el.getContext('2d')
        console.log(ctx)

        ctx.fillStyle = 'red'
        ctx.fillRect(0, 0, 300, 300)
    </script>
</html>
